package com.rovinj_server.fragment;

import android.app.ProgressDialog;
import android.support.v4.app.Fragment;
import android.widget.Toast;

import com.rovinj_server.app.MyApplication;

/**
 * Created by Administrator on 2017/6/23.
 */

public class BaseFragmet extends Fragment {


    public ProgressDialog mProgressDialog;

    public void set_ColseDialog() {
        getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                mProgressDialog.dismiss();
            }
        });
    }

    public void set_showDialog(final String str) {
        getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                mProgressDialog = ProgressDialog.show(getActivity(), "", "正在" + str + "请稍等");
                mProgressDialog.setCancelable(false);
                mProgressDialog.setIndeterminate(true);
                mProgressDialog.show();
            }
        });
    }

    public void set_Toast(final String m_Toast) {
        getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(MyApplication.getContext(), "" + m_Toast, Toast.LENGTH_SHORT).show();
            }
        });
    }
}
